package util;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;


public class MailTitleBody {
	
	public enum MailTitleBodyEnum {
			PASS_RETRIEVAL("pass_retrieval.html"),
			USER_CONFIRMATION("user_confirmation.html"),
			USER_REJECTION("user_rejection.html"),
			FRIEND_REQUEST("friend_request.html"),
			IMPORTED_USER("imported_user.html");
		
		
			private MailTitleBody mtb;
			MailTitleBodyEnum(String file) { this.mtb = new MailTitleBody(file);}
			MailTitleBodyEnum(String title, String body) { this.mtb = new MailTitleBody(title, body);}
			public MailTitleBody getTitleAndBody() { return this.mtb; }
	};
	
	private String title;
	private String body;
	private String[] passes;
		
	public MailTitleBody(String file){
		Scanner sc;
		try {
			sc = new Scanner(new File("src/main/resources/emails/"+file));
			this.title = sc.nextLine();
			this.body = sc.nextLine();
		} catch (FileNotFoundException e) {
			
		}
	}
	
	public MailTitleBody(String title, String body) {
		this.body = body;
		this.title = title;
	}
	
	public void appendNameToTitle(String name) {
		this.title = name + this.title;
	}
	
	public void appendPassToBody(String pass) {
		this.body += pass;
	}
	
	public void appendPasses(String[] pass) {
		this.passes = pass;
	}
	
	public String[] getPasses() {
		return this.passes;
	}
	
	public String getTitle() {
		return this.title;
	}
	
	public String getBody() {
		return this.body;
	}
}